package com.wenx.beancamel;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

public class BeanCamel extends RouteBuilder {
    public static void main(String[] args) throws Exception {
        CamelContext context = new DefaultCamelContext(); // 1. 创建 CamelContext.
        context.addRoutes(new BeanCamel());
        context.setTracing(true);
        context.start(); // 4. 启动CamelContext.
        Thread.sleep(Integer.MAX_VALUE);  // 为了保持CamelContext处于工作状态，这里需要sleep主线程
        context.stop(); // 最后停止CamelContext
    }
    public void configure() throws Exception {
        from("timer://foo?fixedRate=true&period=1000")
                .setBody()
                .simple("wenxing")
                .bean(HelloBean.class)
                .to("stream:out");
    }
}
